package org.dromara.app.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import lombok.RequiredArgsConstructor;
import jakarta.validation.constraints.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.dromara.common.web.core.BaseController;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.core.domain.R;
import org.dromara.bean.domain.vo.HisActivityVo;
import org.dromara.bean.domain.bo.HisActivityBo;
import org.dromara.app.service.AHisActivityService;
import org.dromara.common.mybatis.core.page.TableDataInfo;

/**
 * 活动
 *
 * @author Lion Li
 * @date 2025-01-09
 */
@Validated
@RequiredArgsConstructor
@RestController
@SaIgnore
@RequestMapping("/app/activity")
public class AHisActivityController extends BaseController {

    private final AHisActivityService hisActivityService;


    /**
     * 查询活动列表
     */
    @GetMapping("/list")
    public TableDataInfo<HisActivityVo> list(HisActivityBo bo, PageQuery pageQuery) {
        return hisActivityService.queryPageList(bo, pageQuery);
    }


    /**
     * 获取活动详细信息
     *
     * @param id 主键
     */
    @GetMapping("/{id}")
    public R<HisActivityVo> getInfo(@NotNull(message = "主键不能为空")
                                    @PathVariable Long id) {
        return R.ok(hisActivityService.queryById(id));
    }


}
